UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RWpkapU17W51XlY4Cjg1j710blLTLmiMKShgYBkYPeY=' 
WHERE 
  key_id = '42fdd89574866d87add1d8d9b721e3136800658cc359063ee0d2a7fe30b0fe25' 
  AND (
    token = 'RWpkapU17W51XlY4Cjg1j710blLTLmiMKShgYBkYPeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040