UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TYAge1mDtyvttbdZJg51rGJaOuimaxvYlexUpz/vQFE=' 
WHERE 
  key_id = 'b76790067937578a3a02a1b5086dd70a89cc4bc34ab5cd0f60608d70d6a5888d' 
  AND (
    token = 'TYAge1mDtyvttbdZJg51rGJaOuimaxvYlexUpz/vQFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025