UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Aivcr9OVnzz6irulYxNodMhCIQdd2f+/Der5blRjW28=' 
WHERE 
  key_id = '4b0a1b143d0677b8d879bb3c6c17b8204e268545e860081c5e6471bf92664d50' 
  AND (
    token = 'Aivcr9OVnzz6irulYxNodMhCIQdd2f+/Der5blRjW28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029