UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4KORuuqonq/fFdOahD2XoGMFNXPg+oChSGAiMy/yX+c=' 
WHERE 
  key_id = '8761a551832b81a92389f9b50bd31fcefa8e68b0689565f37e4c27346594555c' 
  AND (
    token = '4KORuuqonq/fFdOahD2XoGMFNXPg+oChSGAiMy/yX+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029