UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zY76Rom3p0uqFrtKzaRfjMIdJb7m95WmRP9sb5YABXQ=' 
WHERE 
  key_id = '793beca99b7c2f070679d4d4a628699287a9cace7181224e06f992ab747c0c24' 
  AND (
    token = 'zY76Rom3p0uqFrtKzaRfjMIdJb7m95WmRP9sb5YABXQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035