UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QQUEQvQ67PKsyzcJK2CU9voVwG/oDe4Oqt8U6Z+mXqc=' 
WHERE 
  key_id = 'c2f8e63b325b4a7e6bb9823036c1559e47d9e6b13b7e58633de9cd5e513e501e' 
  AND (
    token = 'QQUEQvQ67PKsyzcJK2CU9voVwG/oDe4Oqt8U6Z+mXqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032