UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hBINY/lC+D052rYxZQheykrc5YW+iUWZjkbaf7aQOq8=' 
WHERE 
  key_id = 'a2ca0a9da0329b3d076da156eee73a8770e688304883d89304ee1cf071d1a9aa' 
  AND (
    token = 'hBINY/lC+D052rYxZQheykrc5YW+iUWZjkbaf7aQOq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040