UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MDy+kp+RaTNwMj8j/MheyjWs1fqBy3zk9jhqcdYWBjo=' 
WHERE 
  key_id = 'e7aff8e55346b9057ffa2f360c052bfd14023b90cdd271aa370693eef72509ee' 
  AND (
    token = 'MDy+kp+RaTNwMj8j/MheyjWs1fqBy3zk9jhqcdYWBjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029