UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S1SkhifEL7vEXsJR0aoG8j+qi8NR3ZF5u93/ygOo3A0=' 
WHERE 
  key_id = 'cbe85d7b74bf8d0490bb65d03a69f376512c1d4940ad5d4475fb6fd39564f407' 
  AND (
    token = 'S1SkhifEL7vEXsJR0aoG8j+qi8NR3ZF5u93/ygOo3A0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045