UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sfA63mXP89gT4Giqsifal+NZFr3O237qfBFYCXekhGk=' 
WHERE 
  key_id = '136616181734fb489dcfda9031d3a966687ad3423fba5d44f96b6d6a9262b411' 
  AND (
    token = 'sfA63mXP89gT4Giqsifal+NZFr3O237qfBFYCXekhGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033