UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '20Y9nvawiwEcpRCK+WUIujWrf/9vIONLN9SReEQ/z3c=' 
WHERE 
  key_id = 'b5c19c3297b32743bc4c92c9afdfb20130701e43ee7e3fd1f88aef1678b5ac32' 
  AND (
    token = '20Y9nvawiwEcpRCK+WUIujWrf/9vIONLN9SReEQ/z3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023