UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/38EwJ2i22d8aX1WJGGCIoSPdLy2muUlgsV8Ycx6+4=' 
WHERE 
  key_id = '28b7e0b9ae7a2dbadf3da28937978f5570fbb35b395ad854df0c2fb25cb4ffa4' 
  AND (
    token = 'S/38EwJ2i22d8aX1WJGGCIoSPdLy2muUlgsV8Ycx6+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031