UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h1ZbLNjS3UY10x20GEUCf7rsBAKkTsADAxr/j8SW2CA=' 
WHERE 
  key_id = '655291aef5d314fdbc8fed8f6299650565fe82aa378a722c5464894e51321b76' 
  AND (
    token = 'h1ZbLNjS3UY10x20GEUCf7rsBAKkTsADAxr/j8SW2CA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020