UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kSGIvX/Fku+IIJlVRfiaYJANfa7zdSD0umW5NQtcjPs=' 
WHERE 
  key_id = 'dc1ece50f2795e1ff96e8250bf2c1fd61b34ea372fe85a8fe0f3c4f4e329da57' 
  AND (
    token = 'kSGIvX/Fku+IIJlVRfiaYJANfa7zdSD0umW5NQtcjPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058