UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xj7Dx+gUBX+Jv4I4Ye6WivX4ulOXiX9fCv851iSWWN8=' 
WHERE 
  key_id = '7d16ace9ef14d082cbdbac8103e2257b120480cdff1a163eeb4ba64154620f66' 
  AND (
    token = 'Xj7Dx+gUBX+Jv4I4Ye6WivX4ulOXiX9fCv851iSWWN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041