UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cefGsqvrIG8j+SmmEN8PDinvrjTVwOO/pzxf6GyM7rM=' 
WHERE 
  key_id = '7afb129b1145802ec3006987be3cbb2b7367e7d1eae7435f56dfaad5e464feb8' 
  AND (
    token = 'cefGsqvrIG8j+SmmEN8PDinvrjTVwOO/pzxf6GyM7rM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034