UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oBN7ClC8vgIpMbWXKMBltWuBUcYdjWD5GjL5Dk7CkQU=' 
WHERE 
  key_id = 'f8b3ce67fcbe333713dfb6243b31662317ca6cc3992a0893acb0a5e902c3ec2d' 
  AND (
    token = 'oBN7ClC8vgIpMbWXKMBltWuBUcYdjWD5GjL5Dk7CkQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030