UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oYkAHZYSAC+NsaknobkuOgmOeipTOkGbCWvOr9Pmy4k=' 
WHERE 
  key_id = '2b78fc45d788153d57ac71bb71b17a0784dfde394bbb00b097f9d44f988e179b' 
  AND (
    token = 'oYkAHZYSAC+NsaknobkuOgmOeipTOkGbCWvOr9Pmy4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033