UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wzKWggZkYbKF5uQhdP2iXgGJv0pbQ6eCNElI4PlFkRQ=' 
WHERE 
  key_id = 'a38a74ee151297e8e00115060b55fb454748b357091f694ca32fd5b649bd2a36' 
  AND (
    token = 'wzKWggZkYbKF5uQhdP2iXgGJv0pbQ6eCNElI4PlFkRQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028