UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '38B8i1/su8j5DfZ4byf8c1L1atNv1oGREBSr+NCx6aU=' 
WHERE 
  key_id = 'b683cd8bdfb6b4935ae2f5f42fbcad606bcce5163a263faf14e4fec92b9852b8' 
  AND (
    token = '38B8i1/su8j5DfZ4byf8c1L1atNv1oGREBSr+NCx6aU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065