UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rDJfK2xn2Bp5l4Cuaj883Xu6aPLL6jlnVzhJmP5A3iE=' 
WHERE 
  key_id = '66809e0df40694863a0caaf3f50359563d9b569585e49827500cc301cb609de8' 
  AND (
    token = 'rDJfK2xn2Bp5l4Cuaj883Xu6aPLL6jlnVzhJmP5A3iE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051