UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4VrOfeYI9wHPzjSX24xtIsB8+GyyQRs9Qg5Uy42Rv5o=' 
WHERE 
  key_id = '78dea4e66da1346d163e87d3932a41837b60183b60f144709176beda9b2fc896' 
  AND (
    token = '4VrOfeYI9wHPzjSX24xtIsB8+GyyQRs9Qg5Uy42Rv5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037