UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EbdI8bQAuS0wxtNOyk4C5rHTkeahgSfVfFNEPWRTH6Y=' 
WHERE 
  key_id = '4aca443bf205cf3883a9fe99505c4edf38801710733b2592aec4b0ebc2c09d27' 
  AND (
    token = 'EbdI8bQAuS0wxtNOyk4C5rHTkeahgSfVfFNEPWRTH6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024