UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E2Wrn87/BPsgOv3Lo06MTb2BepBvNUOUjG2AMCXo9Ao=' 
WHERE 
  key_id = '7e68cc09906b1be335b3d342cc0cc71a69f0a916d503f0a74182cdb05552a320' 
  AND (
    token = 'E2Wrn87/BPsgOv3Lo06MTb2BepBvNUOUjG2AMCXo9Ao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051