UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yBeYtQxGtI/Fr8iJjJFUptyx9jwYj79kwnJzl9O27Yw=' 
WHERE 
  key_id = 'cc7a5f45c873d3edf26b408645367e69dd108a2684ac71c6dbd65f3d33403803' 
  AND (
    token = 'yBeYtQxGtI/Fr8iJjJFUptyx9jwYj79kwnJzl9O27Yw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025