UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'csc9MflQCWavL56J4Jks5qAQ6/CJi8/n51UUTPBEpbI=' 
WHERE 
  key_id = 'd54565d757ea2a5479a1d49be832226a7307d3bc4598197620c9856db4d7c3d8' 
  AND (
    token = 'csc9MflQCWavL56J4Jks5qAQ6/CJi8/n51UUTPBEpbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061