UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eUqSpa15lCPE8CC7MCB3cx9TkPV43RpOZfRZkdNueds=' 
WHERE 
  key_id = '2de5db3b1b32d29f5a7a91ad5b29ba761f9abd50afbe5484f054cb20d651e987' 
  AND (
    token = 'eUqSpa15lCPE8CC7MCB3cx9TkPV43RpOZfRZkdNueds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040