UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RB8EK2Nl7fVTH6UCf+q9JF0J9Xa1rOBbBh/rGAGgIwA=' 
WHERE 
  key_id = '13303a544b1e5dd1c1d5fedebad0acd4c63d01c1e1888535548676d2c3c46fc3' 
  AND (
    token = 'RB8EK2Nl7fVTH6UCf+q9JF0J9Xa1rOBbBh/rGAGgIwA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037