UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0njw62WUo46mAt79kqiIhWt6IhXsGd6q2ZofCs4m5dk=' 
WHERE 
  key_id = '1c99666b3a5536d641f9f48a8ac561709fb7276719cbeafc916f7384cec31e7f' 
  AND (
    token = '0njw62WUo46mAt79kqiIhWt6IhXsGd6q2ZofCs4m5dk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041