UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Md+oCED/dqdxEiu3jkA6SOGpHSYVx6WijBTMUfCukEY=' 
WHERE 
  key_id = '0a234ef2904730bd61482d8984fa87fe21488e1dd872bbe3419d8d930dab67db' 
  AND (
    token = 'Md+oCED/dqdxEiu3jkA6SOGpHSYVx6WijBTMUfCukEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023