UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1+8zJFTsmjfhCDMimkn/s4bGyGV0iK3IuSFEeWpIoc8=' 
WHERE 
  key_id = '04cf7fe7b757b136181cc68746d2b0d5b66863a4eddb79773df203e4120fdba2' 
  AND (
    token = '1+8zJFTsmjfhCDMimkn/s4bGyGV0iK3IuSFEeWpIoc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034