UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3JBQbqawea+gpOEh95gjz9SwmsRb+8U9moBdZFX8tzU=' 
WHERE 
  key_id = 'fab5412b547797ee03ff92181cf79a4c81907755911e7b9c71221b53e84030b2' 
  AND (
    token = '3JBQbqawea+gpOEh95gjz9SwmsRb+8U9moBdZFX8tzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023