UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GSoxDgLQWMMy8VlsFnfe1JL2mlbQwEOmG/Qhup+1bhc=' 
WHERE 
  key_id = '3ddcca5ba215df34efd1a514b6cb135cd24396877948498057f2793f2030279a' 
  AND (
    token = 'GSoxDgLQWMMy8VlsFnfe1JL2mlbQwEOmG/Qhup+1bhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031